<?php
/* Represents a scheduled (but not necessarily completed) game */
class Game {
	protected $m_id;
	protected $m_team1_id;
	protected $m_team2_id;
	protected $m_scheduled_date;
	protected $m_scheduled_time_start;
	protected $m_scheduled_time_end;
	protected $m_winner_id;
	protected $m_score1;
	protected $m_score2;
	protected $m_facility;
	protected $m_sport; /* free text or id? */
	protected $htime;

	public function __construct($gameid, $team1_id, $team2_id, $sport, $facility, $htime) {
		$this->m_id = $gameid;
		$this->m_team1_id = $team1_id;
		$this->m_team2_id = $team2_id;
		$this->m_sport = $sport;
		$this->m_facility = $facility;
		$this->m_htime = $htime;
	}

    /* human readable representation of time */
    public function getHtime() { return $this->m_htime; }

    /* getters and setters */
	public function getId() { return $this->m_id; }
	public function getTeam1Id() { return $this->m_team1_id; }
	public function getTeam2Id() { return $this->m_team2_id; }
	public function setTeam1Id($id) { $this->m_team1_id = $id; }
	public function setTeam2Id($id) { $this->m_team2_id = $id; }

	public function setGameDate($d) { $m_scheduled_date = $d; }
	public function getGameDate() { return $this->m_scheduled_date; } 
	public function setTime($start,$end) {
		$this->m_scheduled_time_start = $start;
		$this->m_scheduled_time_end = $end;
	}
	public function submitScores($team1, $team2) {
		$this->m_score1 = $team1;
		$this->m_score2 = $team2;
	}
	public function getScore() { return array($this->m_score1, $this->m_score2); }

	public function setWinner($id) { $this->m_winner_id = $id; }
	public function getWinner() { return $this->m_winner_id; }
	public function getSport() { return $this->m_sport; }
	public function getFacility() { return $this->m_facility; }

}
